package com.ruoyi.depot.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 库存出库日志表
 * @TableName tb_outbound_stock_log
 */
@TableName(value ="tb_outbound_stock_log")
@Data
public class OutboundStockLog implements Serializable {
    /**
     * 主键，自增
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 出库订单编号（可选）
     */
    @TableField(value = "outbound_order_id")
    private String outboundOrderId;

    /**
     * 关联的入库记录ID
     */
    @TableField(value = "batch_id")
    private Integer batchId;

    /**
     * 关联的SKU
     */
    @TableField(value = "sku")
    private String sku;

    /**
     * 扣减数量
     */
    @TableField(value = "deducted_quantity")
    private Integer deductedQuantity;

    /**
     * 扣减时间
     */
    @TableField(value = "deducted_date")
    private Date deductedDate;

    /**
     * 扣减成本（扣减数量×单价）
     */
    @TableField(value = "deduction_cost")
    private BigDecimal deductionCost;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OutboundStockLog other = (OutboundStockLog) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getOutboundOrderId() == null ? other.getOutboundOrderId() == null : this.getOutboundOrderId().equals(other.getOutboundOrderId()))
            && (this.getBatchId() == null ? other.getBatchId() == null : this.getBatchId().equals(other.getBatchId()))
            && (this.getDeductedQuantity() == null ? other.getDeductedQuantity() == null : this.getDeductedQuantity().equals(other.getDeductedQuantity()))
            && (this.getDeductedDate() == null ? other.getDeductedDate() == null : this.getDeductedDate().equals(other.getDeductedDate()))
            && (this.getDeductionCost() == null ? other.getDeductionCost() == null : this.getDeductionCost().equals(other.getDeductionCost()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOutboundOrderId() == null) ? 0 : getOutboundOrderId().hashCode());
        result = prime * result + ((getBatchId() == null) ? 0 : getBatchId().hashCode());
        result = prime * result + ((getDeductedQuantity() == null) ? 0 : getDeductedQuantity().hashCode());
        result = prime * result + ((getDeductedDate() == null) ? 0 : getDeductedDate().hashCode());
        result = prime * result + ((getDeductionCost() == null) ? 0 : getDeductionCost().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", outboundOrderId=").append(outboundOrderId);
        sb.append(", batchId=").append(batchId);
        sb.append(", deductedQuantity=").append(deductedQuantity);
        sb.append(", deductedDate=").append(deductedDate);
        sb.append(", deductionCost=").append(deductionCost);
        sb.append(", remark=").append(remark);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}